<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>山寨京东</title>
    <link rel="shortcut icon" href="favicon.ico"/>
    <link rel="stylesheet" href="css/base.css"/>
    <link rel="stylesheet" href="css/index.css"/>
</head>
<body>
   <!--顶部工具栏start-->
   <div class="shortcut clearfix">
       <div class="w">
           <ul class="fl">
               <li class="dropdown">送至：北京
                   <i><s>◇</s></i>
               </li>
           </ul>
           <ul class="fr">
               <li><a href="#">你好，请登录</a>&nbsp;&nbsp;<a href="#" class="col-red">免费注册</a></li>
               <li class="spacer"></li>
               <li><a href="#">我的订单</a></li>
               <li class="spacer"></li>
               <li class="drdn"><a href="#">我的京东</a><i><s>◇</s></i></li>
               <li class="spacer"></li>
               <li><a href="#">京东会员</a></li>
               <li class="spacer"></li>
               <li><a href="#">企业采购</a></li>
               <li class="spacer"></li>
               <li class="drdn tel-li"><a href="#"><b class="tel"></b>手机京东</a><i><s>◇</s></i></li>
               <li class="spacer"></li>
               <li class="drdn"><a href="#">关注京东</a><i><s>◇</s></i></li>
               <li class="spacer"></li>
               <li><a href="#">客户服务</a></li>
               <li class="spacer"></li>
               <li class="drdn"><a href="#">网站导航</a><i><s>◇</s></i></li>
           </ul>
       </div>
   </div>
   <!--顶部工具栏end-->

   <!--顶部广告start-->
   <div class="banner" id="banner">
       <div class="w close_parent">
           <a href="#"><img src="images/ad.jpg"/></a>
           <a href="javascript:;" class="close_banner"></a>
       </div>
   </div>
   <!--顶部广告end-->

   <!--head部分start-->
   <div class="header clearfix">
       <div class="w">
           <div class="logo">
               <a href="#" class="logo-a">京东</a>
           </div>
           <div class="search">
               <input type="text" value="TCL厨卫"/>
               <button>搜索</button>
           </div>
           <div class="car">
               <b></b>
               <a href="#">我的购物车</a>
               <i class="gt"><s>◇</s></i>
                <!--或者使用大于号制作，并且设置大于号的字体<i>&gt;</i>-->
               <i class="car_num">100</i>
           </div>
           <div class="hotwords">
               <ul>
                   <li><a href="#" class="col-red">美丽食谱</a></li>
                   <li><a href="#">家电红包</a></li>
                   <li><a href="#">自营鲜花</a></li>
                   <li><a href="#">388减188</a></li>
                   <li><a href="#">蝴蝶节</a></li>
                   <li><a href="#">机箱</a></li>
                   <li><a href="#">牛仔外套女</a></li>
                   <li><a href="#">0元试用</a></li>
                   <li><a href="#">豆豆鞋</a></li>
               </ul>
           </div>
       </div>
   </div>
   <!--head部分end-->

   <!--nav部分strat-->
   <div class="nav clearfix">
       <div class="w">
               <div class="category">
                   <h2 class="category_dt">
                       <a href="#">全部商品分类</a>
                   </h2>
                   <div class="category_dd">
                       <h3 class="category_item">
                           <a href="#">家用电器</a>
                           <i>&gt;</i>
                       </h3>
                       <h3 class="category_item">
                           <a href="#">手机、数码、京东通信</a>
                           <i>&gt;</i>
                       </h3>
                       <h3 class="category_item">
                           <a href="#">电脑、办公</a>
                           <i>&gt;</i>
                       </h3>
                       <h3 class="category_item">
                           <a href="#">家居、家具、家装、厨具</a>
                           <i>&gt;</i>
                       </h3>
                       <h3 class="category_item">
                           <a href="#">男装、女装、内衣、珠宝</a>
                           <i>&gt;</i>
                       </h3>
                       <h3 class="category_item">
                           <a href="#">个护化妆、清洁用品</a>
                           <i>&gt;</i>
                       </h3>
                       <h3 class="category_item">
                           <a href="#">鞋靴、箱包、钟表、奢侈品</a>
                           <i>&gt;</i>
                       </h3>
                       <h3 class="category_item">
                           <a href="#">运动户外</a>
                           <i>&gt;</i>
                       </h3>
                       <h3 class="category_item">
                           <a href="#">汽车、汽车用品</a>
                           <i>&gt;</i>
                       </h3>
                       <h3 class="category_item">
                           <a href="#">母婴、玩具乐器</a>
                           <i>&gt;</i>
                       </h3>
                       <h3 class="category_item">
                           <a href="#">食品、酒类、生鲜、特产</a>
                           <i>&gt;</i>
                       </h3>
                       <h3 class="category_item">
                           <a href="#">家用电器</a>
                           <i>&gt;</i>
                       </h3>
                       <h3 class="category_item">
                           <a href="#">营养保健</a>
                           <i>&gt;</i>
                       </h3>
                       <h3 class="category_item">
                           <a href="#">图书、音像、电子书</a>
                           <i>&gt;</i>
                       </h3>
                       <h3 class="category_item">
                           <a href="#">彩票、旅行、充值、票务</a>
                           <i>&gt;</i>
                       </h3>
                   </div>

               </div>
           <ul class="jd_nav">
               <li class="w3 hot_li">
                   <a href="#">服装厂</a>
                   <img src="images/hot.png" alt="" class="hot"/>
               </li>
               <li class="w3"><a href="#">美妆馆</a></li>
               <li class="w2"><a href="#">超市</a></li>
               <li class="w3"><a href="#">全球购</a></li>
               <li class="w2"><a href="#">闪购</a></li>
               <li class="w2"><a href="#">团购</a></li>
               <li class="w2"><a href="#">拍卖</a></li>
               <li class="w2"><a href="#">金融</a></li>
           </ul>

       </div>

   </div>
   <!--nav部分end-->

   <!-- 主体部分start-->
   <div class="main w clearfix" id="main">
        <div class="slider">
            <ul>
                <li>
                    <a href="#">
                        <img src="images/slider.jpg" alt=""/>
                    </a>
                </li>
                <li>
                    <a href="#">
                    <img src="images/slider1.jpg" alt=""/>
                </a>
                </li>
                <li>
                    <a href="#">
                        <img src="images/slider2.jpg" alt=""/>
                    </a>
                </li>
                <li>
                    <a href="#">
                        <img src="images/slider3.jpg" alt=""/>
                    </a>
                </li>
                <li>
                    <a href="#">
                        <img src="images/slider4.jpg" alt=""/>
                    </a>
                </li>
                <li>
                    <a href="#">
                        <img src="images/slider5.jpg" alt=""/>
                    </a>
                </li>
            </ul>
            <ol></ol>
            <!--<ul class="circle">
                <li>1</li>
                <li>2</li>
                <li>3</li>
                <li>4</li>
                <li class="current">5</li>
                <li>6</li>
             </ul>-->
            <div class="arrow" id="arrow">
                <a href="javascript:;" class="arr_l" id="arr_l">&lt;</a>
                <a href="javascript:;" class="arr_r" id="arr_r">&gt;</a>
            </div>
        </div>
        <div class="main-extra">
           <!--顶部京东快报部分-->
           <div class="news">
               <div class="mt">
                   <h3>京东快报</h3>
                   <a href="#">更多&nbsp;&gt;</a>
               </div>
               <!--顶部京东快报内容部分-->
               <div class="mc">
                   <ul>
                       <li><a href="#"><span>[特惠]</span>华帝品牌日，抢免单，赢半价！</a></li>
                       <li><a href="#"><span>[公告]</span>厦门大件运营中心搬迁</a></li>
                       <li><a href="#"><span>[特惠]</span>初春尝鲜，全场商品低至8折</a></li>
                       <li><a href="#"><span>[公告]</span>北京城区部分区域配送延迟</a></li>
                       <li><a href="#"><span>[特惠]</span>京东数码影音节，每满199-30</a></li>
                   </ul>
               </div>
           </div>
           <!--中间生活服务相关部分-->
           <div class="lifserv">
               <ul>
                   <li>
                       <i class="icon1"></i>
                       <a href="#">话费</a>
                   </li>
                   <li>
                       <i class="icon2"></i>
                       <a href="#">机票</a>
                   </li>
                   <li>
                       <i class="icon3"></i>
                       <a href="#">电影票</a>
                   </li>
                   <li>
                       <i class="icon4"></i>
                       <a href="#">游戏</a>
                   </li>
                   <li>
                       <i class="icon5"></i>
                       <a href="#">彩票</a>
                   </li>
                   <li>
                       <i class="icon6"></i>
                       <a href="#">团购</a>
                   </li>
                   <li>
                       <i class="icon7"></i>
                       <a href="#">酒店</a>
                   </li>
                   <li>
                       <i class="icon8"></i>
                       <a href="#">火车票</a>
                   </li>
                   <li>
                       <i class="icon9"></i>
                       <a href="#">众筹</a>
                   </li>
                   <li>
                       <i class="icon10"></i>
                       <a href="#">理财</a>
                   </li>
                   <li>
                       <i class="icon11"></i>
                       <a href="#">礼品卡</a>
                   </li>
                   <li>
                       <i class="icon12"></i>
                       <a href="#">白条</a>
                   </li>
               </ul>
           </div>
           <!--底部图片部分-->
           <div class="right-pic">
               <a href="#">
                   <img src="images/right-pic.jpg" alt=""/>
               </a>
           </div>
       </div>
   </div>
   <!-- 主体部分end-->

   <!--今日推荐start-->
   <div class="today w clearfix">
       <div class="mt">
           <img src="images/clock.png" alt=""/>
       </div>
       <div class="mc">
           <ul>
               <li><img src="images/today.jpg" alt=""/></li>
               <li><img src="images/today.jpg" alt=""/></li>
               <li><img src="images/today.jpg" alt=""/></li>
               <li><img src="images/today.jpg" alt=""/></li>
           </ul>
       </div>
   </div>
   <!--今日推荐end-->

   <!--猜你喜欢start-->
   <div class="like w clearfix">
       <div class="mt clearfix">
           <h3>猜你喜欢</h3>
           <a href="javascript:;">换一批</a>
       </div>
       <div class="mc">
           <div class="mc_l">
               <h3></h3>
               <ul>
                   <li><a href="#">生活家</a></li>
                   <li><a href="#">吃货</a></li>
                   <li><a href="#">休闲小食</a></li>
                   <li><a href="#">凹造型</a></li>
                   <li><a href="#">爱厨房</a></li>
                   <li><a href="#">时尚前卫</a></li>
               </ul>
           </div>
           <div class="mc_r">
               <div class="like1 fl likes">
                   <div><a href="#"><img src="images/like_1.jpg" alt=""/></a></div>
                   <div class="description"><a href="#">爱格aige32cm真空炒锅不粘</a></div>
                   <div class="price">¥159.00</div>
               </div>
               <div class="like2 fl likes">
                   <div><a href="#"><img src="images/like_2.jpg" alt=""/></a></div>
                   <div class="description"><a href="#">苏泊尔无油烟不粘炒锅烹饪</a></div>
                   <div class="price">¥139.00</div>
               </div>
               <div class="like3 fl likes">
                   <div><a href="#"><img src="images/like_3.jpg" alt=""/></a></div>
                   <div class="description"><a href="#">尚古主义2016春装新款宽松</a></div>
                   <div class="price">¥129.00</div>
               </div>
               <div class="like4 fl likes">
                   <div><a href="#"><img src="images/like_4.jpg" alt=""/></a></div>
                   <div class="description"><a href="#">拉夏贝尔 puella普埃拉2016</a></div>
                   <div class="price">¥129.00</div>
               </div>
               <div class="like5 fl likes">
                   <div><a href="#"><img src="images/like_5.jpg" alt=""/></a></div>
                   <div class="description"><a href="#">铁摩图 CZZJ202R X1车载</a></div>
                   <div class="price">¥29.00</div>
               </div>
           </div>
       </div>
   </div>
   <!--猜你喜欢end-->

   <!--京东-品质生活start -->
   <div class="qualitylife w clearfix">
       <div class="mt">
           <h2>京东 · 品质生活</h2>
       </div>
       <div class="mc">
           <div class="types">
               <ul>
                   <li class="type_li1">
                       <a href="#">
                           <p class="type_mt">新发现</p>
                           <div class="type_content1">
                               <p class="type_st">新品尖货</p>
                               <p class="description1">京东家电全国沸腾惠</p>
                               <p class="description2">400元优惠券每天1千张</p>
                           </div>
                           <img src="images/type_t1.jpg" alt=""/>
                       </a>
                   </li>
                   <li class="type_li2">
                       <a href="#">
                           <p class="type_mt">好东西</p>
                           <div class="type_content1">
                               <p class="type_st">精品推荐</p>
                               <p class="description1">“表”白神器</p>
                               <p class="description2">领200元券</p>
                           </div>
                           <img src="images/type_t2.jpg" alt=""/>
                       </a>
                   </li>
                   <li class="type_li3">
                       <a href="#">
                           <p class="type_mt">品牌街</p>
                           <div class="type_content1">
                               <p class="type_st">今日大牌</p>
                               <p class="description1">三星与智能触碰</p>
                               <p class="description2">买显示器送键盘</p>
                           </div>
                           <img src="images/type_t3.jpg" alt=""/>
                       </a>
                   </li>
                   <li class="type_li4">
                       <a href="#">
                           <div class="type_content2">
                               <p class="type_st">预售抢鲜</p>
                               <p class="description1">UA男子库里2代</p>
                               <p class="description2">新品低至5折</p>
                           </div>
                           <img src="images/type_b1.jpg" alt=""/>
                       </a>
                   </li>
                   <li class="type_li5">
                       <a href="#">
                           <div class="type_content2">
                               <p class="type_st">新品首发</p>
                               <p class="description1">大松电饭煲</p>
                               <p class="description2">新品低价发售</p>
                           </div>
                           <img src="images/type_b2.jpg" alt=""/>
                       </a>
                   </li>
                   <li class="type_li6">
                       <a href="#">
                           <div class="type_content2">
                               <p class="type_st">新奇好货</p>
                               <p class="description1">体感游戏手柄</p>
                               <p class="description2">好货低至1元</p>
                           </div>
                           <img src="images/type_b3.jpg" alt=""/>
                       </a>
                   </li>
                   <li class="type_li7">
                       <a href="#">
                           <div class="type_content2">
                               <p class="type_st">国际大牌</p>
                               <p class="description1">RIMOWA 京东专供</p>
                               <p class="description2">低至5折</p>
                           </div>
                           <img src="images/type_b4.jpg" alt=""/>
                       </a>
                   </li>
                   <li class="type_li8">
                       <a href="#">
                           <div class="type_content2">
                               <p class="type_st">科技精品</p>
                               <p class="description1">玩科技</p>
                               <p class="description2">净化凉风取暖合一</p>
                           </div>
                           <img src="images/type_b5.jpg" alt=""/>
                       </a>
                   </li>
               </ul>
           </div>
           <div class="brands">
               <ul>
                   <li class="brand_1i1"><a href="#" class="brand1"><img src="images/1nb.jpg" alt=""/></a></li>
                   <li class="brand_li2"><a href="#" class="brand2"><img src="images/2bally.jpg" alt=""/></a></li>
                   <li class="brand_1i3"><a href="#" class="brand3"><img src="images/3burberry.jpg" alt=""/></a></li>
                   <li class="brand_1i4"><a href="#" class="brand4"><img src="images/4jack.jpg" alt=""/></a></li>
                   <li class="brand_1i5"><a href="#" class="brand5"><img src="images/5.jpg" alt=""/></a></li>
                   <li class="brand_1i6"><a href="#" class="brand6"><img src="images/6.jpg" alt=""/></a></li>
                   <li class="brand_1i7"><a href="#" class="brand7"><img src="images/7.jpg" alt=""/></a></li>
                   <li class="brand_1i8"><a href="#" class="brand8"><img src="images/8.jpg" alt=""/></a></li>
                   <li class="brand_1i9"><a href="#" class="brand9"><img src="images/9.jpg" alt=""/></a></li>
                   <li class="brand_1i10"><a href="#" class="brand10"><img src="images/10.jpg" alt=""/></a></li>
                   <li class="brand_1i11"><a href="#" class="brand11"><img src="images/11.jpg" alt=""/></a></li>
                   <li class="brand_1i12"><a href="#" class="brand12"><img src="images/12.jpg" alt=""/></a></li>
                   <li class="brand_1i13"><a href="#" class="brand13"><img src="images/13.jpg" alt=""/></a></li>
                   <li class="brand_1i14"><a href="#" class="brand14"><img src="images/14.jpg" alt=""/></a></li>
               </ul>
           </div>
       </div>
       </div>
   <!--京东-品质生活end -->

   <!--楼层前的广告start -->
   <div class="w floor_bef_g clearfix">
       <a href="#"><img src="images/g_l.jpg" alt=""/></a>
       <a href="#"><img src="images/g_c.jpg" alt=""/></a>
       <a href="#"><img src="images/g_r.jpg" alt=""/></a>
   </div>
   <!--楼层前的广告end -->

   <!-- 楼层start-->
   <div class="floor">
       <!-- 楼层1-start-->
       <div class="floor1">
           <div class="w">
               <div class="floor1_top floors_top">
                   <ul class="fl">
                       <!--<li class="floor1_img"></li>-->
                       <li class="floor1_img"><i></i><h2>服装鞋包</h2></li>
                   </ul>
                   <ul class="fr f_t_r">
                       <li class="first_a"><a href="javascript:;">大牌</a></li>
                       <li class="spacer"></li>
                       <li><a href="javascript:;">男装</a></li>
                       <li class="spacer"></li>
                       <li><a href="javascript:;">女装</a></li>
                       <li class="spacer"></li>
                       <li><a href="javascript:;">鞋靴</a></li>
                       <li class="spacer"></li>
                       <li><a href="javascript:;">箱包</a></li>
                       <li class="spacer"></li>
                       <li><a href="javascript:;">内衣配饰</a></li>
                       <li class="spacer"></li>
                       <li><a href="javascript:;">珠宝首饰</a></li>
                       <li class="spacer"></li>
                       <li><a href="javascript:;">奢品礼服</a></li>
                       <li class="spacer"></li>
                       <li class="last_a"><a href="javascript:;">奢华腕表</a></li>
                   </ul>
               </div>
               <div class="floor1_content floors_content">
                   <img src="images/floor1_total.png" alt=""/>
               </div>
               <div class="floor1_bottom floors_bottom"></div>
           </div>
       </div>
       <!-- 楼层1-end-->
       <!-- 楼层2-start-->
       <div class="floor2">
           <div class="w">
               <div class="floor2_top"></div>
               <div class="floor2_content"></div>
               <div class="floor2_bottom"></div>
           </div>
       </div>
       <div class="floor3"></div>
       <div class="floor4"></div>
       <div class="floor5"></div>
       <div class="floor6"></div>
       <div class="floor7"></div>
       <div class="floor8"></div>
       <div class="floor9"></div>
       <div class="floor10"></div>
       <div class="floor11"></div>
       <!-- 楼层2-end-->
   </div>
   <!-- 楼层end-->

   <!--footer部分start-->
   <div class="foot">
       <div class="service">
           <div class="slogan">
               <span class="slogan_item slogan1"><img src="images/slogen1.png" alt=""/></span>
               <span class="slogan_item slogan2"><img src="images/slogen2.png" alt=""/></span>
               <span class="slogan_item slogan3"><img src="images/slogen3.png" alt=""/></span>
               <span class="slogan_item slogan4"><img src="images/slogen4.png" alt=""/></span>
           </div>
           <div class="w info clearfix">
               <dl>
                   <dt>购物指南</dt>
                   <dd><a href="#">购物流程</a></dd>
                   <dd><a href="#">会员介绍</a></dd>
                   <dd><a href="#">生活旅行团购</a></dd>
                   <dd><a href="#">常见问题</a></dd>
                   <dd><a href="#">大家电</a></dd>
                   <dd><a href="#">联系客服</a></dd>
               </dl>
               <dl>
                   <dt>配送方式</dt>
                   <dd><a href="#">购物流程</a></dd>
                   <dd><a href="#">会员介绍</a></dd>
                   <dd><a href="#">生活旅行团购</a></dd>
                   <dd><a href="#">常见问题</a></dd>
                   <dd><a href="#">大家电</a></dd>
                   <dd><a href="#">联系客服</a></dd>
               </dl>
               <dl>
                   <dt>支付方式</dt>
                   <dd><a href="#">购物流程</a></dd>
                   <dd><a href="#">会员介绍</a></dd>
                   <dd><a href="#">生活旅行团购</a></dd>
                   <dd><a href="#">常见问题</a></dd>
                   <dd><a href="#">大家电</a></dd>
                   <dd><a href="#">联系客服</a></dd>
               </dl>
               <dl>
                   <dt>售后服务</dt>
                   <dd><a href="#">购物流程</a></dd>
                   <dd><a href="#">会员介绍</a></dd>
                   <dd><a href="#">生活旅行团购</a></dd>
                   <dd><a href="#">常见问题</a></dd>
                   <dd><a href="#">大家电</a></dd>
                   <dd><a href="#">联系客服</a></dd>
               </dl>
               <dl class="dl_last">
                   <dt>特色服务</dt>
                   <dd><a href="#">夺宝岛</a></dd>
                   <dd><a href="#">DIY装机</a></dd>
                   <dd><a href="#">延保服务</a></dd>
                   <dd><a href="#">京东E卡</a></dd>
                   <dd><a href="#">京东通信</a></dd>
                   <dd><a href="#">京东JD+</a></dd>
               </dl>
               <div class="coverage">
                   <div class="coverage_top">京东自营覆盖区县</div>
                   <p class="coverage_ds">京东已向全国2433个区县提供自营配送服务，支持货到付款、POS机刷卡和售后上门服务。</p>
                   <p class="coverage_detail"><a href="#">查看详情&nbsp;&gt;</a></p>
               </div>
           </div>
       </div>
       <div class="w bottom">
           <div class="links">
               <a href="#">关于我们</a>|
               <a href="#">联系我们</a>|
               <a href="#">商家入驻</a>|
               <a href="#">营销中心</a>|
               <a href="#">手机京东</a>|
               <a href="#">友情链接</a>|
               <a href="#">销售联盟</a>|
               <a href="#">京东社区</a>|
               <a href="#">京东公益</a>|
               <a href="#">English Site</a>|
               <a href="#">Contact Us</a>
           </div>
           <div class="copyright">
               <img src="images/police.png" alt=""/>
               京公网安备 11000002000088号  |  京ICP证070359号  |  互联网药品信息服务资格证编号(京)-经营性-2014-0008  |  新出发京零 字第大120007号<br />
               音像制品经营许可证苏宿批005号  |  出版物经营许可证编号新出发(苏)批字第N-012号  |  互联网出版许可证编号新出网证(京)字150号<br />
               网络文化经营许可证京网文[2014]2148-348号  违法和不良信息举报电话：4006561155  Copyright &copy; 2004-2016  京东JD.com 版权所有<br />
               京东旗下网站：京东钱包
           </div>
           <div class="authentication">
               <a href="#"><img src="images/auth.png" alt=""/></a>
               <a href="#"><img src="images/auth.png" alt=""/></a>
               <a href="#"><img src="images/auth.png" alt=""/></a>
               <a href="#"><img src="images/auth.png" alt=""/></a>
               <a href="#"><img src="images/auth.png" alt=""/></a>
               <a href="#"><img src="images/auth.png" alt=""/></a>
           </div>
       </div>
   </div>
   <!--footer部分end-->
</body>
</html>
<script>
    //要做事先找人
    var main = document.getElementById("main");
    var slider = main.children[0];
    var ul = slider.children[0];
    var ol = slider.children[1];
    var ulLis = ul.children;//所有的图片
    var imgWidth = slider.offsetWidth;
    var arr = document.getElementById("arrow");
    var arrRight = document.getElementById("arr_r");
    var arrLeft = document.getElementById("arr_l");
    var timer = null;
    //alert(imgWidth);

    //1.动态生成结构
    //1.1根据图片的数量动态生成按钮
    for (var i = 0; i < ulLis.length; i++) {
        //动态生成按钮
        var li = document.createElement("li");
        //给li添加序号
        //索引号是从0开始的
        //序号=索引号+1
        li.innerHTML = i + 1;
        //追加到ol下面
        ol.appendChild(li);
    }
    var olLis = ol.children;//必须生成之后才能获取到
    olLis[0].className = "current";

    //1.2把第一张图片追加到最后
    //复制第一张图片
    var firstImg = ulLis[0].cloneNode(true);
    //追加到ul后面
    ul.appendChild(firstImg);

    //2.鼠标经过按钮
    //循环遍历 给每一个按钮绑定鼠标经过事件
    for (var j = 0; j < olLis.length; j++) {
        olLis[j].index = j;
        olLis[j].onmouseover = function () {
            //按钮排他
            //干掉所有人
            for (var k = 0; k < olLis.length; k++) {
                olLis[k].className = "";
            }
            //留下我自己
            this.className = "current";
            //根据索引号 通过动画函数移动ul
            //图片移动的位置 和 当前按钮索引号 和 图片宽度有关 而且是负数
            var target = -this.index * imgWidth;
            animate(ul, target);

            //将应该显示的图片的索引号 和 鼠标经过的按钮的索引号 进行统一
            pic = this.index;
            //将应该亮起的按钮的索引号 和 鼠标经过的按钮的索引号 进行统一
            square = this.index;
        }
    }

    //3.鼠标点击箭头
    //鼠标经过box显示arr 清理定时器停止自动播放
    main.onmouseover = function () {
        arr.style.display = "block";
        //clearInterval(timer);
    }
    //鼠标离开box隐藏arr 设置定时器继续自动播放
    main.onmouseout = function () {
        arr.style.display = "none";
        //timer = setInterval(playNext, 1000);
    }

    //点击 右箭头 显示下一张
    var pic = 0;//pic表示当前图片的索引
    var square = 0;//square表示当前按钮的索引
    arrRight.onclick = function () {
        playNext();
    }
    arrLeft.onclick = function () {
        //判断当前图片的索引pic是否等于最后一张图片的索引ulLis.length-1
        if (pic == 0) {
            pic = ulLis.length - 1;
            ul.style.left = -(ulLis.length - 1) * imgWidth + "px";
        }
        pic--;
        //通过动画函数对ul进行移动
        //target 和 图片索引 和 图片宽度 有关 而且是负数
        var target = -pic * imgWidth;
        animate(ul, target);

        //按钮也应该自动播放
        //如果当前按钮的索引号square大于第一个按钮的索引号0 就--
        if (square > 0) {
            square--;
        } else {
            //如果square等于零 说明到第一个了 这时就应该把他变成最后一个
            square = olLis.length - 1;
        }
        //干掉所有人
        for (var i = 0; i < olLis.length; i++) {
            olLis[i].className = "";
        }
        //留下我自己
        olLis[square].className = "current";
    }

    //4.添加自动滚动
    //timer = setInterval(playNext, 1000)

    function playNext() {
        //先判断当前图片的索引pic是否等于最后一张图片的索引ulLis.length-1
        //如果相等马上跳过去然后在执行动画效果 从而实现无缝滚动
        //并且把索引号也归零
        if (pic == ulLis.length - 1) {
            ul.style.left = 0;
            pic = 0;
        }
        pic++;//pic++相当于 pic=pic+1;
        //通过动画函数对ul进行移动
        //target 和 图片索引 和 图片宽度 有关 而且是负数
        var target = -pic * imgWidth;
        animate(ul, target);

        //按钮也应该自动播放
        //如果当前按钮的索引号square小于最后一个按钮的索引号olLis.length - 1 就++
        if (square < olLis.length - 1) {
            square++;
        } else {
            square = 0;
        }

        //干掉所有人
        for (var i = 0; i < olLis.length; i++) {
            olLis[i].className = "";
        }
        //留下我自己
        olLis[square].className = "current";
    }

    //5.完善鼠标经过


    function animate(obj, target) {
        clearInterval(obj.timer);
        obj.timer = setInterval(function () {
            var step = 25;
            var step = obj.offsetLeft < target ? step : -step;

            //Math.abs(obj.offsetLeft - target) 这个表示对象到目标的距离
            //如果对象到目标的距离比一步迈出的距离要大 我就要继续走

            if (Math.abs(obj.offsetLeft - target) > Math.abs(step)) {
                obj.style.left = obj.offsetLeft + step + "px";
            } else {
                //再迈一步就超过目标了
                obj.style.left = target + "px";//手动把对象放置到目标上
                clearInterval(obj.timer);//清理定时器
            }
        }, 15)
    }
</script>
